www.gusucode.com > 6KBBS ASP版 V7.1 > 6KBBS ASP版 V7.1\code\bbs\Usersetup.asp

    <!--#include file="up.asp"--><!--#include file="inc/regfun.asp"--><!--#include file="inc/md5.asp"--><!--#include file="inc/grade.asp"-->
<link rel="stylesheet" type="text/css" href="skin/<%=Cssstyleid%>/bbs.css">
<%dim action,userinfo,burn,sql
action=request.querystring("action")
if lguserid="" or isnull(lguserid) then response.redirect"login.asp"
select case action
case"myinfo"
set rs=conn.execute("select*from [user] where userid="&lguserid&" and not del")
userinfo=rs("userinfo")
userinfo=split(userinfo,"|")
burn=userinfo(2)
burn=split(burn,"-")
session(prefix&"regtime")=userinfo(9)
%>
<form method="POST" action="usersetup.asp?action=edit" name="form">
<table class="useredit" cellpadding="0" style="border-collapse: collapse">
<tr>
    <td><div class=useredittitle>用户资料修改</div></td>
  </tr>
  <tr>
    <td class=useredittitle2>必填资料:</td>
  </tr>
  <tr>
    <td width="100%">
    <table class=usereditbody>
      <tr>
        <td width="40%">
        <p style="line-height: 120%; margin: 4"><b>用户名</b>:<br>你在该论坛注册的用户名,不可以修改</p></td>
        <td width="60%"> <b><%=checktitle(lgname)%></b></td>
      </tr>
      <tr>
        <td><p style="line-height: 120%; margin: 4"><b>性别</b>:<br>请选择您的性别</td>
        <td> <input type=radio name=sex value=1 <%if userinfo(4)=1 then%>checked<%end if%>>   
        <img src="images/boy.gif">帅哥&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=radio name=sex value=2 <%if userinfo(4)=2 then%>checked<%end if%>>   
        <img src="images/girl.gif">靓女</td>
      </tr>
      <tr>
        <td><p style="line-height: 120%; margin: 4"><b>Email地址</b>:<br>请输入有效的邮件地址,这将使您能用到论坛中的所有功能</td>
        <td> <input type=text name=email size=30 maxlength=30 value="<%=checktitle(userinfo(0))%>"></td>
      </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class=useredittitle2>选填资料:</td>
  </tr>
  <tr>
    <td width="100%">
	<table class=usereditbody>
      <tr>
        <td width="40%"><p style="line-height: 120%; margin: 4"><b>生日:</b>(请按照2000-01-01格式填写)</td>
        <td width="60%"> <input type=text name=burn1 size=4 maxlength=4 value="<%=burn(0)%>">年<input type=text name=burn2 size=2 maxlength=2 value="<%=burn(1)%>">月<input type=text name=burn3 size=2 maxlength=2 value="<%=burn(2)%>">日</td>
      </tr>
      <tr>
        <td><p style="line-height: 120%; margin: 4"><b>主页:</b><br>
        填写你的个人主页,让大家见识见识</td>
        <td> <input type=text name=home size=30 maxlength=255 value="<%=checktitle(userinfo(1))%>"></td>
      </tr>
      <tr>
        <td><p style="line-height: 120%; margin: 4"><B>OICQ号码</B>:<BR>填写您的QQ地址,方便与他人的联系</td>
        <td> <input type=text name=qq size=16 maxlength=15 value="<%=userinfo(3)%>"></td>
      </tr>
      <tr>
        <td><p style="line-height: 120%; margin: 4"><b>我的头像:</b><br>使用论坛自带的图像</td>
        <td><br> <select name=bbspic size=1 onChange="showimage()" style="font-size: 9pt">
<%for i=1 to checknum(application(prefix&"picnum"))%>
<option value=<%=i%>><%=i%></option>
<%next%>
</select> <img src="images/headpic/1.gif" name="tus"><script>function showimage(){document.images.tus.src="images/headpic/"+document.form.bbspic.options[document.form.bbspic.selectedIndex].value+".gif";document.form.mypic.value="images/headpic/"+document.form.bbspic.options[document.form.bbspic.selectedIndex].value+".gif";document.form.picw.value="<%=checknum(application(prefix&"autopicw"))%>";document.form.pich.value="<%=checknum(application(prefix&"autopich"))%>";}</script> [ <a target="_blank" href="help.asp?action=allheadpic">查看所有头像</a> ]<br>&nbsp;
</td>
      </tr>
      <tr>
        <td><p style="line-height: 120%; margin: 4"><B>自定义头像</B>:<br>如果图像位置中有连接图片将以自定义的为主</td>
        <td>
        <p style="margin: 8"><input name=mypic size=38 maxlength=100 value="<%=checktitle(userinfo(5))%>"> 完整Url地址<br>图像宽度:<input type=text name=picw size=6 value="<%=checktitle(userinfo(6))%>"> 高度: 
        <input type=text name=pich size=6 value="<%=checktitle(userinfo(7))%>">(宽最大<%=checknum(application(prefix&"picw"))%> &nbsp; 高最大<%=checknum(application(prefix&"pich"))%>)<br>
        <IFRAME name=ad src="upload.asp?action=headpic" frameBorder=0 width="95%" scrolling=no height=37></IFRAME>
</td>
      </tr>
      <tr>
        <td><p style="line-height: 120%; margin: 4"><b>自定义头衔:</b><br>
        填写你喜欢的头衔,最多8个字母或汉字。</td>
        <td> <%if rs("grade")>=1 then
        session(prefix&"tempgrade")=rs("grade")%><input type=text name=diyname size=30 maxlength=255 value="<%=checktitle(userinfo(10))%>"><%else%>该项需要等级为 <b>1</b> 以上的用户才能使用。<%end if%></td>
      </tr>

      <tr>
        <td><p style="line-height: 120%; margin: 4"><B>个性签名</B>:<BR>最多255个字符<BR>文字将出现在您发表的文章的结尾处。体现您的个性。</td>
        <td>
        <p style="margin: 8">
        <TEXTAREA name=gxqm rows=5 wrap=PHYSICAL cols=60 style="font-family: 宋体; font-size: 9pt"><%=checktitle(userinfo(8))%></TEXTAREA></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td width="100%" height="40" align="center">
    <input class=submit type=submit value=我填好了,现在修改! name=Submit>&nbsp;&nbsp; <input class=submit type=reset value=不行,还是重写吧! name=Submit2></td>
  </tr>
</table></form>
<%case"edit" 
dim password,repassword,email,sex,burn1,burn2,burn3,home,qq,gxqm,picw,pich,bbspic,mypic,toupic
dim canreg,z,sickpass,regtime,userid,newuserinfo,bad,b,diyname

function checkbad(str)
if isnull(str) then exit function 
bad=split(application(prefix&"badcontent"), "|")
for b=0 to ubound(bad)
str=Replace(str,bad(b),string(len(bad(b)),"*")) 
next
checkbad=str
end function

email=Replace(Request.Form("email"),"'","''")
sex=checknum(request.form("sex"))
burn1=replace(Request.Form("burn1"),"'","")
burn2=replace(Request.Form("burn2"),"'","")
burn3=replace(Request.Form("burn3"),"'","")
home=Replace(Request.Form("home"),"'","''")
home=ubbg(home)
qq=Replace(Request.Form("qq"),"'","''")

gxqm=Request.Form("gxqm")
gxqm=Replace(left(gxqm,255),"'","''")
gxqm=replace(gxqm,"|","│")
gxqm=checkbad(gxqm)

if checknum(session(prefix&"tempgrade"))>=1 then
diyname=Request.Form("diyname")
diyname=Replace(left(diyname,8),"'","")
diyname=replace(diyname,"|","│")
diyname=checkbad(diyname)
end if

picw=Replace(Request.Form("picw"),"'","''")
pich=Replace(Request.Form("pich"),"'","''")

mypic=Replace(Request.Form("mypic"),"'","''")
mypic=ubbg(mypic)
bbspic=Replace(Request.Form("bbspic"),"'","''")

canreg=true
if email="" or sex="" then
canreg=false
mes="·请填写完整必填的资料。<br>"
else
mes=""

email=server.HTMLEncode(email)
if not IsValidEmail(email) then canreg=false : mes=mes&"·你的E-mail填写错误。<br>"

end if


burn=burn1&"-"&burn2&"-"&burn3
if not isdate(burn) then burn="--"

if qq<>"" and (not isnumeric(qq) or (len(qq)<5 or len(qq)>12)) then canreg=false:mes=mes&"·你的 QQ 号码填写错误。<br>"

if mypic="" then
toupic=""&styleid&"/headpic/"&bbspic&".gif|"&checknum(application(prefix&"autopicw"))&"|"&checknum(application(prefix&"autopich"))
else
if picw<>"" and checknum(picw)<=checknum(application(prefix&"picw")) and pich<>"" and checknum(pich)<=checknum(application(prefix&"pich")) then
toupic=mypic&"|"&picw&"|"&pich
else
canreg=false
mes=mes&"·你的头像大小设置错误。<br>"
end if
end if

if checknum(application(prefix&"headpicset"))<>1 and instr(toupic,"://")>0 then
canreg=false
mes=mes&"·本论坛不允许使用外部头像。<br>"
end if


if canreg=false then
tl=" 修 改 失 败"
mes="<b>对不起!你不能成功地修改资料,可能存在以下问题。</b><br>"&mes&"·<a href='javascript:history.go(-1)'><img border=0 src="&styleid&"/re.gif align=absmiddle> 返回重新填写。</a>"
elseif canreg=true then
'修改
userinfo=email&"|"&home&"|"&burn&"|"&qq&"|"&sex&"|"&toupic&"|"&gxqm&"|"&split(conn.execute("select userinfo from [user] where userid ="&lguserid&"")(0),"|")(9)&"|"&diyname
'结束
conn.execute("update [user] set userinfo='"&userinfo&"' where userid="&lguserid&"")
tl=" 修 改 成 功"
mes="你的资料修改成功。"
end if
call sendinfo(tl,mes)
%>
<%case"mypwd"%>
<form method="POST" action="usersetup.asp?action=editpwd">
<table class=useredit cellpadding="0" style="border-collapse: collapse">
  <tr>
    <td><div class=useredittitle>修改密码</div></td>
  </tr>
  <tr>
    <td width="100%">
    <table class=usereditbody>
      <tr>
        <td width="40%">
        <p style="line-height: 120%; margin: 4"><b>旧密码确认</b>:<br>
        请输入旧密码进入确认</td>
        <td width="60%"> <input type="password" name="oldpwd" size="30"></td>
      </tr>
      <tr>
        <td>
        <p style="line-height: 120%; margin: 4">
<b>新密码(最多16位)</b>:<br>请不要使用任何类似 '*'、' ' 或 HTML 字符</td>
        <td> <input type="password" name="newpwd" size="30"></td>
      </tr>
      <tr>
        <td>
        <p style="line-height: 120%; margin: 4"><b>重复密码(最多16位)</b>:<br>请再输一遍确认</td>
        <td> <input type="password" name="repwd" size="30"></td>
      </tr>
      <tr>
        <td colspan="2" height="40" align="center">
        <input class=submit type=submit value="   立 即 修 改   " name=Submit>&nbsp;&nbsp; 
        <input class=submit type=reset value="   重 新 填 写   " name=Submit2></td>
      </tr>
      </table>
    </td>
  </tr>
</table></form>
<%case"editpwd"
dim oldpwd,newpwd,repwd,canedit
oldpwd=Replace(Request.Form("oldpwd"),"'","''")
newpwd=Replace(Request.Form("newpwd"),"'","''")
repwd=Replace(Request.Form("repwd"),"'","''")

canedit=true

if oldpwd="" or newpwd="" or repwd="" then
canedit=false
mes="·请填写完整必填的资料。<br>"
else
mes=""

if md5(oldpwd)<>lgpwd then canedit=false:mes=mes&"·你填写的旧密码不正确。<br>"
if len(newpwd)>16 then canedit=false : mes=mes&"·你填写的新密码长度超过了16。<br>"
if passc(newpwd)=false then canedit=false:mes=mes&"·你的新密码含有非法字符。<br>"
sickpass=split("123$$1234$$12345$$123456$$1234567$$12345678$$aaa$$111","$$")
for i=0 to ubound(sickpass) 
if len(newpwd)<3 or newpwd=sickpass(i) then
canedit=false
mes=mes&"·你的新密码属于弱口令,请更换密码。<br>"
exit for
end if
next
if repwd<>newpwd then canedit=false : mes=mes&"·你两次输入的密码不一样。<br>"

end if

'限制用户名密码不能相同
if newpwd=lgname then
canreg=false
mes=mes&"·你的密码属于弱口令,请更换密码。<br>"
end if
'结束

if canedit=false then
tl=" 修 改 失 败"
mes="<b>对不起!你不能成功修改你的密码,可能存在以下问题。</b><br>"&mes&"·<a href='javascript:history.go(-1)'><img border=0 src="&styleid&"/re.gif align=absmiddle> 返回重新填写。</a>"
elseif canedit=true then
newpwd=md5(newpwd)
conn.execute("update [user] set [password]='"&newpwd&"' where userid="&lguserid&"")

Response.Cookies(prefix)("lgpwd")=newpwd
if lgcook>0 then
Response.Cookies(prefix).Expires=date+lgcook
end if

tl=" 修 改 成 功"
mes="你的密码修改成功。"

end if
call sendinfo(tl,mes)
%>

<%end select
call down%>